<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<div id="app">
			<cpn2></cpn2>
			<cpn></cpn>
		</div>
		<script src="../vue.js" type="text/javascript" charset="utf-8"></script>
		<script type="text/javascript">
			//1.子组件
			let cpnC1 = Vue.extend({
				template:`
					<div>
						<h2>这是标题1</h2>
						<p>这是内容，组件1</p>
					</div>
				`
			});
			//2.父组件
			//一定要记得在父组件的模板中使用子组件,并且要在 最外部的div标签范围内
			let cpnC2 = Vue.extend({
				template:`
					<div>
						<h2>这是标题2</h2>
						<p>这是内容，组件2</p>
						<cpn></cpn>
					</div>
				`,
				components:{
					cpn:cpnC1
				}
			});
			const app = new Vue({
				el: '#app',
				data: {
					message: 'hello'
				},
				components:{
					cpn2:cpnC2
				}
			});
		</script>
	</body>
</html>
